﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="newsDB.*,newsEntity.*,java.sql.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>"> 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>新闻中国</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script language="javascript">
	function check(){
		var login_username = document.getElementById("uname");
		var login_password = document.getElementById("upwd");
		if(login_username.value == ""){
			alert("用户名不能为空！请重新填入！");
			login_username.focus();	
			return false;
		}else if(login_password.value == ""){
			alert("密码不能为空！请重新填入！");
			login_password.focus();
			return false;
		}
		return true;
	}
	
	function focusOnLogin(){
		var login_username = document.getElementById("uname");
		login_username.focus();	
	}
</script>
</head>
<body onload="focusOnLogin()">
  
<div id="header">
<%@ include file="loading.jsp" %>
  <div id="nav">
    <div id="logo"> <img src="images/logo.jpg" alt="新闻中国" /> </div>
    <div id="a_b01"> <img src="images/a_b01.gif" alt="" /> </div>
    <!--mainnav end-->
  </div>
</div>
<div id="container">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<div class="sidebar">
    <h1> <img src="images/title_1.gif" alt="国内新闻" /> </h1>
    <div class="side_list">
      <ul>
      	<%
      		List<News> l1=NewsDao.nd.NewsForNtid(1L);
      		pageContext.setAttribute("l1", l1);
      	%>
      		<c:forEach var="news" items="${l1}">
      		<li><a href="news.jsp?nid=${news.nid}"><b>${news.ntitle}</b></a></li>
      		</c:forEach> 	      	    	   	
      </ul>
    </div>
    <h1> <img src="images/title_2.gif" alt="国际新闻" /> </h1>
    <div class="side_list">
      <ul>      
      	<%
			List<News> l2=NewsDao.nd.NewsForNtid(2L);
			pageContext.setAttribute("l2", l2);
      	%>
      	<c:forEach var="news" items="${l2}">
      	<li><a href="news.jsp?nid=${news.nid}"><b>${news.ntitle}</b></a></li>
      	</c:forEach>  		
      </ul>
    </div>
    <h1> <img src="images/title_3.gif" alt="娱乐新闻" /> </h1>
    <div class="side_list">
      <ul>
         <%
			List<News> l3=NewsDao.nd.NewsForNtid(5L);
			pageContext.setAttribute("l3", l3);
      	%>
      		<c:forEach var="news" items="${l3}">
      		<li><a href="news.jsp?nid=${news.nid}"><b>${news.ntitle}</b></a></li>
      		</c:forEach>  	
      </ul>
    </div>
  </div>
  <div class="main">
    <div class="class_type"> <img src="images/class_type.gif" alt="新闻中心" /> </div>
    <div class="content">
      <ul class="class_date">
      <%
      	List<Topic> list2=TopicDao.td.findTopic();
      	pageContext.setAttribute("list2", list2);
       %>      
	    	<li id='class_month'>
	    	<c:forEach var="topic" items="${list2}" end="10">
	    	<a href="util/news_control.jsp?opr=topicNew&tid=${topic.tid}"><b>${topic.tname}</b></a>
	    	</c:forEach>    
	      	</li>      
	      	<li id='class_month'>
	      	 <c:forEach var="topic" items="${list2}" begin="11">
	    	<a href="util/news_control.jsp?opr=topicNew&tid=${topic.tid}"><b>${topic.tname}</b></a>
	    	</c:forEach>  
      		</li>	
      </ul>
      <ul class="classlist">
      	 <%
      	 	int pageNum=1;
      	 	try{
      	 		pageNum=Integer.parseInt(request.getParameter("pageNum"));
      	 	}catch(Exception e){};
      	 	Page p=NewsDao.nd.findForPageNum(pageNum);
      	 	List<News> list3=p.getList();
      	 	pageContext.setAttribute("list3", list3);
      	 	%>
      	 	<c:forEach var="news" items="${list3}" varStatus="i">
      	 	<li><a href="news.jsp?nid=${news.nid }">${news.ntitle}</a><span>${news.ncreateDate}</span></li>
      	 	<c:if test="${(i.index+1)%5==0}">
      	 	<li class='space'></li>
      	 	</c:if>
      	 	</c:forEach>
  	 	          	     	
	   	<p align="right">
	   	当前页数:[${page.pageNum}/${page.totalPage}]&nbsp
	   	  <c:if test="${page.pageNum>1}">
	   	  <a href="admin.jsp?pageNum=1">首页</a> &nbsp
	   	  <a href="admin.jsp?pageNum=${page.pageNum-1}">上一页</a>&nbsp
	   	  </c:if>
	   	  <c:if test="${page.pageNum<page.totalPage}">
	   	  <a href="admin.jsp?pageNum=${page.pageNum+1}">下一页</a>&nbsp
	   	  <a href="admin.jsp?pageNum=${page.totalPage}">末页</a>
	   	  </c:if>
	   	 </p>     		
      </ul>
    </div>   
<div class="picnews">
  <ul>
    <li> <a href="#"><img src="images/Picture1.jpg" width="249" alt="" /> </a><a href="#">幻想中穿越时空</a> </li>
    <li> <a href="#"><img src="images/Picture2.jpg" width="249" alt="" /> </a><a href="#">国庆多变的发型</a> </li>
    <li> <a href="#"><img src="images/Picture3.jpg" width="249" alt="" /> </a><a href="#">新技术照亮都市</a> </li>
    <li> <a href="#"><img src="images/Picture4.jpg" width="249" alt="" /> </a><a href="#">群星闪耀红地毯</a> </li>
  </ul>
</div>
  </div>
</div>
  <div id="friend">
  <h1 class="friend_t"> <img src="images/friend_ico.gif" alt="合作伙伴" /> </h1>
  <div class="friend_list">
    <ul>
      <li> <a href="#">百度</a> </li>
      <li> <a href="#">谷歌</a> </li>
      <li> <a href="#">新浪</a> </li>
      <li> <a href="#">网易</a> </li>
      <li> <a href="#">搜狐</a> </li>
      <li> <a href="#">人人</a> </li>
      <li> <a href="#">中国政府网</a> </li>
    </ul>
  </div>
</div>
<div id="footer">
  <p class=""> 24小时客户服务热线：010-68988888 &#160;&#160;&#160;&#160; <a href="#">常见问题解答</a> &#160;&#160;&#160;&#160; 新闻热线：010-627488888 <br />
    文明办网文明上网举报电话：010-627488888 &#160;&#160;&#160;&#160; 举报邮箱： <a href="#">jubao@jb-aptech.com.cn</a> </p>
  <p class="copyright"> Copyright &copy; 1999-2009 News China gov, All Right Reserver <br />
    新闻中国 版权所有 </p>
</div>
</body>
</html>
</body>

</html>
